#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include "hashtable.h"

int main() {
    // 测试不同规模的数据集
    int scales[] = {125000, 250000, 500000, 1000000}; // 1/8, 1/4, 1/2, 1倍数
    int numScales = sizeof(scales) / sizeof(scales[0]);

    for (int i = 0; i < numScales; i++) {
        char filename[100];
        sprintf(filename, "user_login_%d.txt", scales[i]);
        printf("\nProcessing %s\n", filename);

        // 读取文件并构造散列表
        clock_t start = clock();
        file_read_ht();
        clock_t end = clock();
        double duration = (double)(end - start) / CLOCKS_PER_SEC;
        printf("Reading and processing time: %.6f seconds\n", duration);

        // 写入文件
        start = clock();
        file_write_ht();
        end = clock();
        duration = (double)(end - start) / CLOCKS_PER_SEC;
        printf("Writing time: %.6f seconds\n", duration);

        // 搜索任务003
        start = clock();
        search_ht();
        end = clock();
        duration = (double)(end - start) / CLOCKS_PER_SEC;
        printf("Search time: %.6f seconds\n", duration);

      
    }

    return 0;
}